/**
 *  Copyright 2011 Miguel Ángel López Vicente 
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package cc.radio.app;
import java.util.Vector;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import cc.utils.Http;

/**
 * Clase para la gestión "general de la radio", es decir...
 * tiene un método para obtener la lista de programas....
 * 
 * Además, dispone de las distintas URLs de las distintas secciones,
 * haciendo que el código quede más limpio
 */
public class Radio {
	
	
	public static Vector<Programa> getProgramas() {
		Vector<Programa> programas = new Vector<Programa>();

		Document html = Jsoup.parse(Http.getUrl(Radio.URL));
		Elements prog = html.select("#leftcolumn .module .menu a");
		for (Element p : prog)
			programas.add(new Programa(p));
		
		

		return programas;
	}
	
	public final static String URL = "http://www.radiouniversidad.es:81";
	public final static String URL_CAPITULO = URL + "/index.php?option=com_content&view=article&id=";
	public final static String URL_PROGRAMA = URL + "/index.php?option=com_content&view=category&layout=blog&id=";

}
